<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core"  prefix="c"%>
<%
	String path=request.getContextPath();
%>
<style type="text/css">
<!--
table {font-family: arial,sans-serif; font-size:11px;}
th {background: #336699; color: #FFFFFF; text-align: center;}
-->
</style>
<html>
  <head>
    <title>用户列表</title>
  </head>
  
  <body bgcolor="#EEF2FB">
<SCRIPT LANGUAGE=javascript>
function del() {
  var msg = "您真的确定要删除吗？";
  if (confirm(msg)==true){
  return true;
  }else{
  return false;
 }
}

</SCRIPT>
	
  <center>
  <h1>用户列表</h1>
   <form action="<%=path%>/user/list.dch" method="get" name="pageForm">
  	查询关键字:<input type="text" name="keyword" value=""/><input type="button" value="查询"/>
  			 
  	<input type="button" value="上一页" onclick="javascrip:currentPage.value='${currentPage-1}';pageForm.submit();" ${result.page.hasPrePage?'':'disabled'}/>
  	<input type="button" value="下一页" onclick="javascrip:currentPage.value='${currentPage+1}';pageForm.submit();" ${result.page.hasNextPage?'':'disabled'}/>
  	<input type="hidden" name="currentPage" value="2"/>
  	转到:
  	<select onchange="javascrip:currentPage.value=this.value;pageForm.submit();">
  		<c:forEach var="i" begin="1" end="${result.page.totalPage}" step="1">
				<option value="${i}" ${currentPage==i?"selected":""}>${i}</option>
	    </c:forEach>
  	</select>
  	</form><br/>
  	共${result.page.totalRecords}条记录，分${result.page.totalPage}页显示，当前第${currentPage}页
  
    <table width="95%"  cellspacing="0" cellpadding="4" border="1" bordercolor="#224466" >
    	<tr bgcolor="#D6D6D6"><th>ID</th><th>用户名</th><th>密码</th><th>注册时间</th><th colspan="2">操作</th></tr>
		<s:iterator value="result.list" id="n">
			<tr><td>${n.userid}</td><td>${n.username}</td><td>${n.password}</td>
			<td>${n.registTime}</td>
			<td><a href="<%=path%>/user/delete.dch?user.userid=${n.userid}&currentPage=${result.page.currentPage}"
			onclick="javascript:return del();" >删除</a></td></tr>
		</s:iterator>
    </table>
   </center>
  </body>
</html>
